package com.wy.allthingdone.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

import com.wy.allthingdone.R;

import org.xutils.x;

/**
 * Created by 38270 on 2016/11/1.
 */

public class BaseActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        x.view().inject(this);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {//创建菜单项
        this.getMenuInflater().inflate(R.menu.menu_setion, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {//菜单项点击事件 实现
        if (item.getItemId() == R.id.action_about) {
            Toast.makeText(this, "点击关于", Toast.LENGTH_SHORT).show();
            return true;
        }
        if (item.getItemId() == R.id.action_clear_cache) {
            Toast.makeText(this, "点击帮助", Toast.LENGTH_SHORT).show();
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}
